<template>
  <div>
      <ul>
        <li v-for="(item, index) in list" :key="index">
              {{ item }}    <button @click="del(index)">删除</button>
        </li>
      </ul>
      <button @click="btn">生成</button>
  </div>
</template>

<script>
export default {

  data(){
    return{
      list:[1, 5, 3]
    }
  },

  methods: {
    
    del(index){
      this.list.splice(index, 1)
    },
    btn(){
        this.list.push(parseInt(Math.random()* 9 + 1))
    }
  }

}
</script>

<style>

</style>